package org.dru.clay.logger;

import java.util.logging.Level;

public class UtilLogger implements Logger {
	private final java.util.logging.Logger logger;
	private final java.util.logging.Logger lifecycle;

	public UtilLogger(java.util.logging.Logger logger, java.util.logging.Logger lifecycle) {
		this.logger = logger;
		this.lifecycle = lifecycle;
	}

	@Override
	public void error(String format, Object... args) {
		if (logger.isLoggable(Level.SEVERE)) {
			logger.severe(String.format(format, args));
		}
	}

	@Override
	public void warn(String format, Object... args) {
		if (logger.isLoggable(Level.WARNING)) {
			logger.warning(String.format(format, args));
		}
	}

	@Override
	public void info(String format, Object... args) {
		if (logger.isLoggable(Level.INFO)) {
			logger.info(String.format(format, args));
		}
	}

	@Override
	public void debug(String format, Object... args) {
		if (logger.isLoggable(Level.FINE)) {
			logger.fine(String.format(format, args));
		}
	}

	@Override
	public void lifecycle(String format, Object... args) {
		lifecycle.info(String.format(format, args));
	}
}
